package org.neuedu.chapter09_0701.practice11;

import java.util.Scanner;

public class Practice11 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String str = scanner.nextLine();
        char[] chars = str.toCharArray();
        int count1 = 0;
        int count2 = 0;
        for (char aChar : chars) {
            if (Character.isLowerCase(aChar)) {
                count1++;
            }else if(Character.isUpperCase(aChar)){
                count2++;
            }
        }
        System.out.println(Math.max(count1,count2));
    }
}
